package com.sure0000.basic;

import java.sql.*;
import java.util.Properties;

/**
 * @author xuyouchang
 * @date 2020/12/25.
 */
public class ShowTables {
    public static void main(String[] args) throws SQLException, ClassNotFoundException {
        // URL parameters
        String url = "jdbc:presto://10.10.77.187:8900/hbase_stable/test_phoenix2";
        Properties properties = new Properties();
        properties.setProperty("user", "root");

        Connection conn = DriverManager.getConnection(url, properties);
        Statement statement = conn.createStatement();
        DatabaseMetaData metadata = conn.getMetaData();
//        ResultSet rs1 = metadata.getTables(conn.getCatalog(), "test_phoenix2", null, new String[] {"TABLE", "VIEW"});
//        while(rs1.next()) {
//            System.out.println(rs1.getString("TABLE_NAME"));
//        }
//        String sql = "select * from test_phoenix2.test_cxj6";
        String sql = "select * from test_phoenix_presto2";
        ResultSet rs = statement.executeQuery(sql);
        while (rs.next()) {
            String res = rs.getString("id");
            System.out.println(res);
        }
    }
}
